"""
PyQt5版GUI工具
"""
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from ui.Ui_main_window import Ui_MainWindow
from views.bluetooth_widget import BluetoothWidget
from views.test_snake3 import SnakeGame
import sys

from qt_material import apply_stylesheet

from views.serial_widget import SerialWidget
from views.bluetooth_widget import BluetoothWidget
from views.net_assist_widget import NetAssistWidget
from views.chat_rooms_widget import ChatRoomsWidget
from views.others_widget import OthersWidget


class MainWindow(QMainWindow):

    def __init__(self):
        super().__init__()
        # 创建对象
        self.ui = Ui_MainWindow()
        # 初始化内容
        self.ui.setupUi(self)

        """
        dark_amber.xml dark_blue.xml dark_cyan.xml dark_lightgreen.xml dark_medical.xml dark_pink.xml dark_purple.xml dark_red.xml dark_teal.xml dark_yellow.xml
        light_amber.xml light_blue.xml light_blue_500.xml light_cyan.xml light_cyan_500.xml light_lightgreen.xml light_lightgreen_500.xml light_orange.xml light_pink.xml light_pink_500.xml light_purple.xml light_purple_500.xml light_red.xml light_red_500.xml light_teal.xml light_teal_500.xml light_yellow.xml
        """
        # apply_stylesheet(self, theme='dark_cyan.xml')

        # 初始化ui
        self.init_ui()

        # 初始化数据
        self.init_data()

    def init_ui(self):
        # 串口
        self.ui.tabWidget.addTab(SerialWidget(self), "串口助手")
        # 蓝牙
        self.ui.tabWidget.addTab(BluetoothWidget(self), "蓝牙助手")
        # 给tabWidget添加一个Tab，网络通信
        self.ui.tabWidget.addTab(NetAssistWidget(self), "网络助手")
        # 给tabWidget添加一个Tab，聊天室
        self.ui.tabWidget.addTab(ChatRoomsWidget(self), "物联网平台")

        self.ui.tabWidget.addTab(OthersWidget(self), "其他")


        # self.ui.tabWidget.setCurrentIndex(3)

    def init_data(self):
        pass


def main():
    app = QApplication(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()
